package com.niiwoo.civet.scheduler.trigger;

import java.util.concurrent.CompletableFuture;

import com.niiwoo.civet.trade.service.lend.ProjectLendDubboService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;


/**
 * 标的放款相关任务
 * @author liaojunjun
 *
 */
@Component
public class ProjectLendJobTrigger {
    private static final Logger logger = LoggerFactory.getLogger(ProjectLendJobTrigger.class);

    @Reference(version = "1.0.0")
    ProjectLendDubboService projectLendDubboService;

    @Scheduled(cron = "${lend.waiting-bank-notify}")
    public void bankLendResultQueryJob() {
        logger.info("银行放款结果查询...");
        CompletableFuture.runAsync(() -> projectLendDubboService.bankLendResultQueryJob());
    }

    @Scheduled(cron = "${lend.waiting-bank-notify}")
    public void bankLendFailedJob() {
        logger.info("银行放款失败任务...");
        CompletableFuture.runAsync(() -> projectLendDubboService.bankLendFailedJob());
    }

    @Scheduled(cron = "${lend.waiting-bank-notify}")
    public void bankProjectStatusJob() {
        logger.info("银行标的状态变更任务...");
        CompletableFuture.runAsync(() -> projectLendDubboService.bankProjectStatusJob());
    }

    @Scheduled(cron = "${lend.waiting-bank-notify}")
    public void accountingStatusJob() {
        logger.info("记账任务...");
        CompletableFuture.runAsync(() -> projectLendDubboService.accountingStatusJob());
    }

    @Scheduled(cron = "${lend.waiting-bank-notify}")
    public void investRankStatusJob() {
        logger.info("投资排行榜任务...");
        CompletableFuture.runAsync(() -> projectLendDubboService.investRankStatusJob());
    }

    @Scheduled(cron = "${lend.waiting-bank-notify}")
    public void borrowerPrizeStatusJob() {
        logger.info("借款人红包任务...");
        CompletableFuture.runAsync(() -> projectLendDubboService.borrowerPrizeStatusJob());
    }

    @Scheduled(cron = "${lend.waiting-bank-notify}")
    public void investorPrizeStatusJob() {
        logger.info("投资人红包任务...");
        CompletableFuture.runAsync(() -> projectLendDubboService.investorPrizeStatusJob());
    }
    
    @Scheduled(cron = "${lend.waiting-bank-notify}")
    public void projectRaiseRateStatusJob() {
        logger.info("标的运营投资加息活动任务...");
        CompletableFuture.runAsync(() -> projectLendDubboService.projectRaiseRateStatusJob());
    }

    @Scheduled(cron = "${lend.waiting-bank-notify}")
    public void packageRaiseRateStatusJob() {
        logger.info("包运营投资加息活动任务...");
        CompletableFuture.runAsync(() -> projectLendDubboService.packageRaiseRateStatusJob());
    }

}